<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
  <head>
    <title>系统设置</title>
    <%@ include file="/WEB-INF/views/common/header.jsp" %>
  </head>
  <body>
    <div class="container">
      <div class="header">
        <h1>系统设置</h1>
        <div class="nav-links">
          <a href="${pageContext.request.contextPath}/blog/admin" class="btn"
            >博客管理</a
          >
          <a href="${pageContext.request.contextPath}/admin/users" class="btn"
            >用户管理</a
          >
          <a
            href="${pageContext.request.contextPath}/logout"
            class="btn btn-danger"
            >退出</a
          >
        </div>
      </div>

      <div class="settings-form">
        <h2>基本设置</h2>
        <form
          action="${pageContext.request.contextPath}/admin/settings"
          method="post"
        >
          <div class="form-group">
            <label>网站标题：</label>
            <input
              type="text"
              name="siteTitle"
              value="${settings.siteTitle}"
              required
            />
          </div>
          <div class="form-group">
            <label>网站描述：</label>
            <textarea name="siteDescription">
${settings.siteDescription}</textarea
            >
          </div>
          <div class="form-group">
            <label>每页显示文章数：</label>
            <input
              type="number"
              name="postsPerPage"
              value="${settings.postsPerPage}"
              required
            />
          </div>
          <div class="form-group">
            <label>
              <input type="checkbox" name="allowComments"
              ${settings.allowComments ? 'checked' : ''} /> 允许评论
            </label>
          </div>
          <div class="form-group">
            <label>
              <input type="checkbox" name="allowRegistration"
              ${settings.allowRegistration ? 'checked' : ''} /> 允许注册
            </label>
          </div>
          <button type="submit" class="btn btn-primary">保存设置</button>
        </form>
      </div>
    </div>
  </body>
</html>
